>> Log into the Cache-A locally with the username: root and the password: cache123

>> Open 'Terminal' on the desktop

>> No we'll stop the various services:

service httpd stop

/etc/init.d/tapemgr stop

service mysqld stop

>> Now we need to see what /media/ is mounted to:

df

>> In this list, you should seen an entry that has /media/ at the end under 'Mounted On'.  If that says /dev/md0 or /dev/sdb, then we'll need to unmount /media/.  
If it's not listed, or if it says /dev/sda, we can proceed without unmounting /media/.  I would also suggest looking at all of the other mount points listed there
 for any instance of /dev/sdb or /dev/md0.  If you see either of those, give us a call or an email.

>> **If you do see /dev/sdb or /dev/md0 next to /media, Then we'll need to stop afp, and unmount /media.  If not, skip this step.

killall afpsd

killall afpd

umount /media/

(There is a chance that at this stage something else is using /media/.  If you cannot unmount, give us a call)

>> Now we'll stop the RAID and clear the superblocks.  There is a good chance that the first command here will tell you that there is no active RAID.  That's OK, just continue on.  
You might also see an error with the zero-superblocks command, again just keep proceeding.

mdadm --manage --stop /dev/md0

mdadm --zero-superblock /dev/sda4

mdadm --zero-superblock /dev/sdb2

>> Now we'll clear the RAID config

cp -p /etc/mdadm.conf /etc/bak.mdadm.conf

rm -f /etc/mdadm.conf

>> Now we'll need to format sda4 (this will take a little time)

mkfs -t ext3 -j /dev/sda4

>> Now we'll clear out /dev/sdb.  We are going to be using a program built-n named parted.  It will probably ask you to confirm each step, say yes to each one, 
ignoring any errors about needing a reboot, by pressing y then enter when prompted.

parted /dev/sdb

rm 1

rm 2

mklabel msdos

quit

>> Now we'll edit fstab back to what it was:

nano /etc/fstab

(Look for a line that reads something like this:)

#/dev/md0/media                  ext4    defaults        1 2

(Now we need to add a # to the front of the line so it reads like this:)

/dev/md0/media                  ext4    defaults        1 2

(Next we need to save the file. Hold the "control" key on your keyboard and push the letter "o". This will ask you to save, press enter. Now press "control" + "x" to exit the editor)

>> Now we'll start Building the RAID:

/usr/cache-a/bin/user_init_system

(Select to build Pr-Cache RAID by pressing 6 then enter)

(choose RAID 0, by pressing 0 then enter)

(Confirm that it's OK by pressing y then enter)

(confirm to continue creating array by pressing y then enter)

(At this point it will start making the RAID and display several lines of text, wait until it says that it's done.)

>> Now reboot by typing:

reboot

>> Assuming the RAID built correctly, you should end up back at the login window after boot. Log in as root again, and open terminal and type:

service httpd stop

/etc/init.d/tapemgr stop

service mysqld stop

>> now we'll navigate to /media/ and drop in a blank catalog:

cd /media/

wget http://cache-a.com/ftpcommon/3.2.3.blank_catalog.tar

>> Once the catalog has downloaded, we need to extract and verify it:

tar xvf 3.2.3.blank_catalog.tar

myisamchk -rovm /media/catalog/database/mysql/catalog/*.MYI

>> You should see a few lines of text, then back to a prompt.  We now need to make the symbolic link to the share:

ln -s /media/vtape/ 'Cache-A Share'

>> Now start the services back

service mysqld start

/etc/init.d/tapemgr start

service httpd start

>> I would now go into the Cache-A UI and check everything out.  You will not have any entries in the catalog because that was on the RAID which was broken when the drive was replaced.  
If you have a catalog backup, I can send instructions on how to use that.  If not, then each time you put a tape in the unit, it will add itself to the catalog.  
You could build the whole catalog back this way.  or just insert tapes as you need them.